﻿// <copyright file="ValidationState.cs" company="City of Portland, BES-ASM">
// </copyright>
// <summary>ValidationState class</summary>

namespace BESASM.EMGAATS.BusinessClasses
{
  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;

  /// <summary>
  /// Validation state for validation errors that carries the error level and relevant object with the failure message.
  /// </summary>
  public class ValidationState
  {
    /// <summary>
    /// Initializes a new instance of the <see cref="ValidationState"/> class.
    /// </summary>
    /// <param name="obj">The object that failed validation.</param>
    /// <param name="level">The error level of the validation failure.</param>
    public ValidationState(object obj, ErrorLevel level)
    {
      this.Object = obj;
      this.Level = level;
    }

    /// <summary>
    /// Gets or sets the object that failed validation.
    /// </summary>
    public object Object { get; set; }

    /// <summary>
    /// Gets or sets the error level of the validation failure.
    /// </summary>
    public ErrorLevel Level { get; set; }

    /// <summary>
    /// Returns a string representation of this object.
    /// </summary>
    /// <returns>A string representation of this object.</returns>
    public override string ToString()
    {
      return string.Format("{0} for {1}", this.Level, this.Object);
    }
  }
}
